package com.zsr.common.constant.product;


public class AttrConstant {

    public enum AttrEnum {
        ATTR_TYPE_BASE(1, "base", "基本属性"),
        ATTR_TYPE_SALE(0, "sale", "销售属性");
        /**
         * 属性数字标识
         */
        private int code;
        /**
         * 属性英文标识
         */
        private String name;
        /**
         * 属性中文说明
         */
        private String msg;

        AttrEnum(int code, String name, String msg) {
            this.code = code;
            this.name = name;

            this.msg = msg;
        }

        public static Integer getCode(String name) {
            for (AttrConstant.AttrEnum attrEnum : values()) {
                if (attrEnum.getName().equalsIgnoreCase(name)) {
                    return attrEnum.getCode();
                }
            }
            return null;
        }

        public int getCode() {
            return code;
        }

        public String getMsg() {
            return msg;
        }

        public String getName() {
            return name;
        }
    }
}
